//
//  SettingTableViewController.swift
//  ElectricStationBoard
//
//  Created by Galaxy on 16/5/23.
//  Copyright © 2016年 Iris. All rights reserved.
//

import UIKit

class SettingTableViewController: UITableViewController {
    
//var titleArr = ["关于我们","用户协议","新功能引导","意见反馈","注销登录"];
    //退出按钮
//    var bt = UIButton();
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationController?.navigationBarHidden = false;
        self.tableView.scrollEnabled = false;
        let footerView = UIView();
        footerView.backgroundColor = UIColor.clearColor();
        (view as? UITableView)?.tableFooterView = footerView;
        

//        bt = UIButton(type: .System);
//        bt.backgroundColor = UIColor.orangeColor();
//        bt.titleLabel?.text = "注销";
//        bt.titleLabel?.textColor = UIColor.whiteColor();
//        bt.addTarget(self, action: #selector(SettingTableViewController.logout), forControlEvents: .TouchUpInside);
//        
//        bt.frame = CGRectMake(180, 400, 80, 50);
//        self.view.addSubview(bt);

        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

//    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
//        
//        return 1;
//    }
//
//    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//        
//        return titleArr.count;
//    }
//
//   
//    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
//        let cell = tableView.dequeueReusableCellWithIdentifier("setreuse", forIndexPath: indexPath)
//
//        cell.textLabel?.text = titleArr[indexPath.row];
//
//        return cell
//    }
   
    //注销
//    func logout() ->Void {
//        let userDefault = NSUserDefaults.standardUserDefaults();
//        userDefault.removeObjectForKey("name");
//        userDefault.removeObjectForKey("password");
//        userDefault.synchronize();
//        self.dismissViewControllerAnimated(true, completion: nil);
//        //跳转到之前页面
//        let story = UIStoryboard(name: "Main", bundle: nil);
//        let vc3 = story.instantiateViewControllerWithIdentifier("me");
//        self.showViewController(vc3, sender: self);
//        print("注销成功");
//    }
//    
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let vc0 = AboutUsViewController();
        let vc1 = AgreementViewController();
        let vc2 = SuggestionViewController();
        let vc3 = GuideViewController();
        let vc4 = LogoutViewController();
        
        switch indexPath.row {
        case 0:
            self.navigationController?.pushViewController(vc0, animated: true);
        case 1:
            self.navigationController?.pushViewController(vc1, animated: true);
        case 2:
            self.navigationController?.pushViewController(vc2, animated: true);
        case 3:
            self.navigationController?.pushViewController(vc3, animated: true);
        case 4:
            self.navigationController?.pushViewController(vc4, animated: true);
        default:
            "Default";
            
        }
        
    }
    
    //点击退出,弹出actionSheet
//    func logOutActionSheet() -> Void {
//        let actionSheet = UIActionSheet(title: "确定", delegate: self, cancelButtonTitle: "取消", destructiveButtonTitle: nil);
//    }

    /*
    // Override to support conditional editing of the table view.
    override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        // Return false if you do not want the specified item to be editable.
        return true
    }
    */

    /*
    // Override to support editing the table view.
    override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        if editingStyle == .Delete {
            // Delete the row from the data source
            tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
        } else if editingStyle == .Insert {
            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
        }    
    }
    */

    /*
    // Override to support rearranging the table view.
    override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {

    }
    */

    /*
    // Override to support conditional rearranging of the table view.
    override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        // Return false if you do not want the item to be re-orderable.
        return true
    }
    */

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
